/**
 * Copyright (c) 2008 Trent Hoeppner
 * 
 * This file is part of BillCalc.
 * 
 * BillCalc is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * BillCalc is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with BillCalc.  If not, see <http://www.gnu.org/licenses/>.
 **/

package com.trentech.billcalc.gui;

import javax.swing.AbstractAction;
import javax.swing.Action;

import testcases.MainTest;


/**
 * EventAction is a base class for Actions in the GUI.
 * 
 * @author Trent Hoeppner
 */
public abstract class SimpleAction extends AbstractAction {
    
    /**
     * Constructor for SimpleAction.
     * 
     * @param   name        the name of the action to be displayed on the 
     *                      button/menu.
     * @param   imageName   the name of the image to load.  If null, no 
     *                      image will be loaded.
     */
    public SimpleAction(String name, String imageName) {
        putValue(Action.NAME, name);
        
        // original : 
        // if (imageName != null) {
        // seed fault : 
        if (MainTest.isOriginal || MainTest.isFaultFound ? (imageName != null) : (imageName == null)) {
        	
            putValue(Action.LARGE_ICON_KEY, BillCalcFrame.loadImage(imageName));
        }
    }
}


